package org.lim.lcpicturebackend.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.lim.lcpicturebackend.model.dto.user.UserLoginRequest;
import org.lim.lcpicturebackend.model.dto.user.UserQueryRequest;
import org.lim.lcpicturebackend.model.dto.user.UserRegisterRequest;
import org.lim.lcpicturebackend.model.entity.User;
import com.baomidou.mybatisplus.extension.service.IService;
import org.lim.lcpicturebackend.model.vo.user.LoginUserVO;
import org.lim.lcpicturebackend.model.vo.user.UserVO;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @author sk
 * @description 针对表【user(用户)】的数据库操作Service
 * @createDate 2025-05-17 19:50:29
 */
public interface UserService extends IService<User> {
    /**
     * 用户注册
     *
     * @param userRegisterRequest
     * @return
     */
    long userRegister(UserRegisterRequest userRegisterRequest);

    /**
     * 对密码加盐加密处理
     *
     * @param userPassword
     * @return
     */
    String getEncryptPassword(String userPassword);
    /**
     * 用户登录
     *
     * @param userLoginRequest
     * @param request
     * @return
     */
    LoginUserVO userLogin(UserLoginRequest userLoginRequest, HttpServletRequest request);

    /**
     * 用户转换
     *
     * @param user
     * @return
     */
    LoginUserVO getLoginUserVo(User user);
    /**
     * 获取登录用户
     *
     * @param request
     * @return
     */
    User getLoginUser(HttpServletRequest request);

//    User getLoginUser();
    /**
     * 用户登出
     *
     * @param request
     * @return
     */
    boolean userLogout(HttpServletRequest request);

    /**
     * 用户登出
     *
     * @return
     */
//    boolean userLogout();

    /**
     * 获取脱敏后的用户数据
     */
    UserVO getUserVO(User user);

    /**
     * 获取脱敏后的用户数据列表
     */
    List<UserVO> getUserVOList(List<User> userList);

    /**
     * 获取查询条件
     *
     * @param userQueryRequest
     * @return
     */
    QueryWrapper<User> getQueryWrapper(UserQueryRequest userQueryRequest);
    /**
     * 获取脱敏后的分页用户数据列表
     */
    Page<UserVO> convertToUserVOPage(Page<User> userPage);

    /**
     * 分页获取用户数据
     *
     * @param userQueryRequest
     * @return
     */
    Page<User> pageUsers(long current, long pageSize, UserQueryRequest userQueryRequest);

    /**
     * 是否为管理员
     *
     * @param user
     * @return
     */
    boolean isAdmin(User user);

}
